package com.markyao.controller.recos;

import com.markyao.recos.regist.RecosRegistService;
import com.markyao.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@CrossOrigin
@RestController
@RequestMapping(value = "/recos/regist")
public class RecosRegistController {
    @Autowired
    RecosRegistService recosRegistService;

    @GetMapping("/registAppName")
    public Result registAppName(@RequestParam("appName") String appName, HttpServletRequest request){
        return recosRegistService.registAppName(appName,request);
    }

    @GetMapping("registUrl")
    public Result registUrl(@RequestParam("appName") String appName,@RequestParam("url") String url) {
        return recosRegistService.registUrl(appName,url);
    }
    @GetMapping("registWeight")
    public Result registWeight(@RequestParam("appName")String appName,@RequestParam("weight") Integer weight){
        return recosRegistService.registWeight(appName,weight);
    }

    @GetMapping("registServer0")
    public Result registServer0(@RequestParam("appName")String appName,@RequestParam("interfaceNAME") String interfaceNAME
            ,@RequestParam("clazz") String clazz)  {
        return recosRegistService.registServer0(appName,interfaceNAME,clazz);
    }
    @GetMapping("registRefrence")
    public Result registRefrence(@RequestParam("appName")String appName
            ,@RequestParam("refrenceName") String refrenceName) {

        return recosRegistService.registRefrence(appName,refrenceName);
    }

    @GetMapping("registConnect")
    public Result registConnect(@RequestParam("appName")String appName,
                                @RequestParam("targetUrl") String targetUrl) {
        return recosRegistService.registConnect(appName,targetUrl);
    }
}
